<%-- 
    Document   : search_visit_list
    Created on : Nov 5, 2013, 8:50:47 PM
    Author     : Mansur
--%>

<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>.: Ship Visit :.</title>    
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.blockUI.js"></script>   
        <script type="text/javascript">
            function unblockUI() {
                $.unblockUI();
            }
            
            function blockUI () {
                $.blockUI();
            }
        </script>
    </head>
    <body>
        <s:messages/>
        <s:errors/>
        <s:useActionBean beanclass="exatrez.stripes.util.ListUtil" var="list"/>
        <s:form beanclass="exatrez.stripes.action.ShipVisitFlowAction" name="form1">
            <div style="align:center">
                <fieldset>
                    <div id="page-title">
                        <span class="title">Search Staff Ship Visit</span>
                    </div>
                    <p>
                        <label>Department :</label>
                        <s:select name="departmentId" style="width:250px">
                            <s:option value="">All</s:option>
                            <s:options-collection collection="${list.listDepart}" label="departmentName" value="departmentId"/>
                        </s:select>
                    </p>
                    <p>
                        <label>Year :</label>
                        <c:set var="count" value="6"/>
                        <c:set var="now" value="<%=new java.util.Date().getYear() + 1900 %>"/>
                        <s:select name="currentYear" style="width:150px">
                            <s:option value="">Please Choose</s:option>
                            <s:option value="${now}">${now}</s:option>
                            <c:forEach var="i" begin="1" end="${count}">
                                <s:option value="${now - i}">${now - i}</s:option>
                            </c:forEach>
                        </s:select>
                        &nbsp;&nbsp;&nbsp;
                        <s:submit name="searchStaffVisit" value="Search" class="btn"/>
                    </p>
                    <div id="page-title">
                        <span class="title">History Ship Visited as per year ${actionBean.currentYear}</span>
                    </div>
                    <div style="align: center">
                        <display:table class="tablecloth" name="${actionBean.listCounter}" requestURI="/shipVisitFlow?searchStaffVisit" id="line" style="width:80%">
                            <display:column title="No." sortable="true" ><center>${line_rowNum}.</center></display:column>
                            <display:column title="User ID" sortable="true" property="user.userId" />                                
                            <display:column title="Department" property="user.department.departmentName" />
                            <display:column title="Target Visit" sortable="true" property="target"/>                            
                            <display:column title="Approved" sortable="true" >
                                <c:if test="${line.visited gt 0}">
                                <a href="shipVisitFlow?searchStaffVisitDetail&staffId=${line.user.userId}&status=A&currentYear=${line.year}">${line.visited}</a>
                                </c:if>
                                <c:if test="${line.visited eq 0}">
                                    ${line.visited}&nbsp;
                                </c:if>
                            </display:column>                            
                            <display:column title="Rejected" >
                                <c:if test="${line.rejected gt 0}">
                                    <a href="shipVisitFlow?searchStaffVisitDetail&staffId=${line.user.userId}&status=R&currentYear=${line.year}">${line.rejected}</a>
                                </c:if>
                                <c:if test="${line.rejected eq 0}">
                                    ${line.rejected}&nbsp;
                                </c:if>                                
                            </display:column>
                            <display:column title="Total Balance" sortable="true"><c:out value="${line.target - line.visited}" /></display:column>                 
                        </display:table>
                    </div>
                </fieldset>
            </div>
        </s:form>
    </body>
</html>